﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace FinanceCalculators.Views.FixedVsAdjustable
{
    public partial class FixedVsAdjustable : PhoneApplicationPage
    {
        public FixedVsAdjustable()
        {
            InitializeComponent();
        }

        //private void button_Click1(object sender, RoutedEventArgs e)
        //{
        //    NavigationService.Navigate(new Uri("/Views/FixedVsAdjustable/Result.xaml", UriKind.Relative));
        //}

        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            txtMortgageLoanAmount.Focus();
                if (ErrorReport)
                    NavigationService.Navigate(new Uri("/Views/FixedVsAdjustable/Result.xaml?ml=" + txtMortgageLoanAmount.Text + "&ea=" + txtExpectedAdjustment.Text + "&fmi=" + txtFixedRateMortgageInterestRate.Text + "&abi=" + txtARMBeginningInterestRate.Text + "&amba=" + txtARMMonthsBefore1stAdjustment.Text + "&airc" + txtARMInterestRateCap.Text + "&iai" + txtInterestOnlyARMBeginningInterestRate.Text + "&iaba" + txtInterestOnlyARMMonthsBefore1stAdjustment.Text + "&iarc" + txtInterestOnlyARMInterestRateCap.Text + "&cc=" + (lstpicfixedvsadj.SelectedItem  as ListBoxItem).Name, UriKind.Relative));
                else
                    MessageBox.Show("Please enter the values", "Request", MessageBoxButton.OKCancel);

        }
        //private bool errorreport;
        public bool ErrorReport
        {
            get
            {
                bool isTextBoxEmpty = false;
                if (txtFixedRateMortgageInterestRate.Text != "" && txtExpectedAdjustment.Text != "" && txtMortgageLoanAmount.Text != "" && txtARMBeginningInterestRate.Text != "" && txtARMMonthsBefore1stAdjustment.Text != "" && txtARMInterestRateCap.Text != "" && txtInterestOnlyARMBeginningInterestRate.Text != "" && txtInterestOnlyARMMonthsBefore1stAdjustment.Text != "" && txtInterestOnlyARMInterestRateCap.Text!="")
                    isTextBoxEmpty = true;
                return isTextBoxEmpty;
            }
        }
        

        private void txtMortgageLoanAmount_TextChanged(object sender, TextChangedEventArgs e)
        {

        }
    
public  string amba { get; set; }}
}